package com.scrcu.idea.ormns.model.po;

import com.google.common.base.CaseFormat;

import java.util.HashSet;
import java.util.Set;

public class Business extends Base {

    private Dao dao;

    public Business(String moduleName, String author, String comment, String name, Dao dao) {
        super(moduleName, comment, name, author);
        this.dao = dao;
    }

    public Dao getDao() {
        return dao;
    }

    public String getSimpleMapper() {
        return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, dao.getModel().getTableName())+ "Mapper";
    }

    public String getLowerSimpleMapper() {
        return getSimpleMapper().substring(0, 1).toLowerCase() + getSimpleMapper().substring(1);
    }

    @Override
    public Set<String> getImports() {
        Set<String> imports = new HashSet<>();
        imports.add(dao.getModel().getPackagePath() + "." + dao.getModel().getSimpleName());
        imports.add(dao.getPackagePath() + "." + dao.getSimpleName());
        return imports;
    }

}
